package com.lbn.monitor.widget.calendar;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.view.ViewGroup;


/**
 * Created by Administrator on 2016/9/13.
 */
public class CalendarFragmentAdapter extends FragmentPagerAdapter {

    private FragmentManager manager;

    public CalendarFragmentAdapter(FragmentManager fm) {
        super(fm);
        this.manager = fm;
    }

    @Override
    public Fragment getItem(int position) {
        return new CalendarFragment().newInstance(position);
    }

    @Override
    public int getCount() {
        return Integer.MAX_VALUE;
    }


    @Override
    public long getItemId(int position) {
        return super.getItemId(position);
    }

    public Fragment getFragment(ViewGroup container, long id) {
        return manager.findFragmentByTag("android:switcher:" + container.getId() + ":" + id);
    }

}
